package StreamOf;

import java.util.stream.Stream;

/**
 * @author zc
 * @version 1.0
 * @date 2021/9/24 10:18
 */
public class Test1{
    public static void main(String[] args) {
        Stream<Integer> mystream = Stream.of(10, 12, 14, 16);
        mystream.forEach(e -> System.out.println(e) );

        Stream<String> aa = Stream.of("AA", "BB", "CC", "DD");
        aa.forEach(e-> System.out.println(e));
        Stream<User> userStream = Stream.of(
                new User("Mahesh", 22),
                new User("Krishn", 20),
                new User("Suresh", 25)
        );
        userStream.forEach(u -> System.out.println(u.getUserName()));
    }
}

class User {
    private String userName;
    private int age;
    public User(String userName, int age) {
        this.userName = userName;
        this.age = age;
    }
    //Sets and Gets

    public String getUserName() {
        return userName;
    }
}

